package com.oocl.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.dao.BookDao;
import com.oocl.dao.impl.BookDaoImpl;
import com.oocl.pojo.Book;
import com.oocl.pojo.GoodsInfo;

public class GoBackServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private BookDao bookDao;
    public GoBackServlet() {
        super();
        bookDao = new BookDaoImpl();
    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Book> bookList = bookDao.findAllBook();
		String username = (String)request.getAttribute("username");
		request.getSession().setAttribute("username", username);
		
		List<GoodsInfo> goodsInfoList = (List<GoodsInfo>)request.getSession().getAttribute("goodsInfoList");
		request.getSession().setAttribute("goodsInfoList1", goodsInfoList);
		
		request.setAttribute("user1", username);
		request.setAttribute("booklist", bookList);
		request.getRequestDispatcher("sec/shop").forward(request, response);
	}
}
